package org.onvivals.module.system.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.onvivals.common.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * 系统用户
 */
@Schema(description="系统用户")
@Data
@TableName(value = "sys_user")
public class SysUser extends BaseEntity<SysUser> {

    /**
     * ID
     */
    @TableId(value = "user_id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using= ToStringSerializer.class)
    @Schema(description="ID")
    private Long userId;

    /**
     * 用户名
     */
    @TableField(value = "username")
    @Schema(description="用户名")
    private String username;

    /**
     * 昵称
     */
    @TableField(value = "nick_name")
    @Schema(description="昵称")
    private String nickName;

    /**
     * 性别
     */
    @TableField(value = "gender")
    @Schema(description="性别")
    private String gender;

    /**
     * 手机号码
     */
    @TableField(value = "phone")
    @Schema(description="手机号码")
    private String phone;

    /**
     * 邮箱
     */
    @TableField(value = "email")
    @Schema(description="邮箱")
    private String email;

    /**
     * 头像地址
     */
    @TableField(value = "avatar")
    @Schema(description="头像地址")
    private String avatar;

    /**
     * 密码
     */
    @TableField(value = "`password`")
    @Schema(description="密码")
    private String password;

    /**
     * 盐
     */
    @TableField(value = "salt")
    @Schema(description="盐")
    private String salt;

    /**
     * 状态：1启用、0禁用
     */
    @TableField(value = "`status`")
    @Schema(description="状态：1启用、0禁用")
    private Integer status;

    @Schema(description="角色列表")
    @TableField(exist = false)
    private List<SysRole> roles;

    @Schema(description="权限列表")
    @TableField(exist = false)
    private List<SysMenu> authorities;

    private static final long serialVersionUID = 1L;
}
